<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>①兄弟元素之间-上下外边距合并（重叠）</title>
    <style>
      * {
        padding: 0;
        margin: 0;
      }
      .box {
        width: 200px;
        height: 200px;
        background-color: yellowgreen;
      }
      .box1 {
        margin-bottom: 30px; /*下边距30px*/
      }
      .box2 {
        padding-top: 20px; /*上边距20px*/
      }
    </style>
  </head>
  <body>
    <div class="box box1"></div>
    <div class="box box2"></div>
  </body>
</html>
